package com.hyou.sc.common.handler.feign;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Scope;

import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;

@Configuration
public class EnableFeignMultipartSupportConfig {
    
    private static final Logger log = LoggerFactory.getLogger(EnableFeignMultipartSupportConfig.class);
    
    @Bean
    @Primary
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public Encoder multipartFormEncoder() {
        log.info("开启Feing对文件上传功能的支持(multipart/form-data)");
        return new SpringFormEncoder();
    }
    
}
